#BEGIN
#name=transmission
#nead=
#END

#!/bin/bash

apt-get install transmission-daemon -y || exit 1

/etc/init.d/transmission-daemon stop

#change guid et uid
n_uid=2000
n_guid=2000

echo "New uid $n_uid New guid $n_guid"
usermod -u $n_uid debian-transmission
groupmod -g $n_guid debian-transmission
chown -R debian-transmission:debian-transmission /etc/transmission-daemon
chown -R debian-transmission:debian-transmission /var/lib/transmission-daemon



file="/mnt/raid/to_snap/BACKUP/ETC/transmission-daemon/settings.json"
dest="/etc/transmission-daemon/settings.json"
if [[ -f $file ]] ; then
	cp "$file" "$dest" || exit -1
fi

/etc/init.d/transmission-daemon start
